home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************
- *
- * $Source: /unixb/home/unixlib/source/unixlib37/src/unix/c/RCS/ioctl,v $
- * $Date: 1996/11/06 22:01:42 $
- * $Revision: 1.2 $
- * $State: Rel $
- * $Author: unixlib $
- *
- * $Log: ioctl,v $
- * Revision 1.2 1996/11/06 22:01:42 unixlib
- * Yet more changes by NB, PB and SC.
- *
- * Revision 1.1 1996/04/19 21:35:27 simon
- * Initial revision
- *
- ***************************************************************************/
-
- static const char rcs_id[] = "$Id: ioctl,v 1.2 1996/11/06 22:01:42 unixlib Rel $";
-
- #include <errno.h>
- #include <termio.h>
-
- #include <sys/ioctl.h>
- #include <sys/syslib.h>
- #include <sys/unix.h>
- #include <sys/dev.h>
-
- int
- ioctl (int fd, register int request, void *arg)
- {
- register struct file *f;
-
- if (!arg)
- {
- errno = EINVAL;
- return (-1);
- }
-
- if (BADF (fd))
- {
- errno = EBADF;
- return (-1);
- }
-
- f = __u->file + fd;
-
- return __funcall ((*__dev[major (f->dev)].ioctl), (minor (f->dev), request, arg, f));
- }
-
- int
- gtty (register int fd, register struct termio *t)
- {
- return (ioctl (fd, TCGETA, t));
- }
-
- int
- stty (register int fd, register struct termio *t)
- {
- return (ioctl (fd, TCSETA, t));
- }
-